<?php

class videoComponents extends sfComponents
{

    public function executePlaylist()
    {
        // use configuration, if limit is not set
        if(empty($this->limit))
        {
            $this->limit = sfConfig::get('mod_video_limit', 1);
        }

        $c = new Criteria();
        $c->add(VideoPeer::OBJ_TYPE, $this->obj_type);
        $c->add(VideoPeer::STATUS_ID, MyConstants::AdStatusAproved);
        $c->add(VideoPeer::OBJ_ID, $this->obj_id);
        $c->setLimit($this->limit);
    
        $this->videos = VideoPeer::doSelect($c);
        //debugvar($this->video);
    }
    
    public function executePreviewlist()
    {
        // use configuration, if limit is not set
        if(empty($this->limit))
        {
            $this->limit = sfConfig::get('mod_video_limit', 1);
        }

        $c = new Criteria();
        $c->add(VideoPeer::OBJ_TYPE, $this->obj_type);
        $c->add(VideoPeer::STATUS_ID, MyConstants::AdStatusAproved);
        $c->add(VideoPeer::OBJ_ID, $this->obj_id);
        $c->setLimit($this->limit);
    
        $this->videos = VideoPeer::doSelect($c);
        //debugvar($this->video);
    }
	public function executePlay()
    {
        if(!empty($this->id))
        {
        $c = new Criteria();
        $c->add(VideoPeer::ID, $this->id);
        $this->video = VideoPeer::doSelect($c);
        }
        
    }

}
